// Controller/UserStatisticsController_wxt.java
package com.scuec.groupfive.controller;

import com.scuec.groupfive.service.UserService_wxt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/users")
@CrossOrigin
public class UserStatisticsController_wxt {

    @Autowired
    private UserService_wxt userService;

    // 总注册用户数
    @GetMapping("/count")
    public Long getTotalUserCount() {
        return userService.getTotalUserCount();
    }

    // 按自定义时间维度查询
    @GetMapping("/count/by-time")
    public Long getUsersByCustomTimeRange(
            @RequestParam String type,  // 时间维度：day/week/month/year
            @RequestParam String value  // 时间值：格式为YYYY-MM-DD（日）、YYYY-WW（周）、YYYY-MM（月）、YYYY（年）
    ) {
        return userService.getUsersByCustomTimeRange(type, value);
    }
}